/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package fplaton.economics;

import javax.swing.JOptionPane;

/**
 *
 * @author Konstantinos
 */
public class calculations {

    public static float calculateTelikaDidaktra(float arg1, int arg2, int arg3, int arg4, int arg5, String arg6, int arg7) {

        float costPerCourse = arg1, paymentMethodCut = 0,
                relativesCut = 0;
        int numberOfCourses = arg2, months = arg3, starterCut = arg4, cutPerKid = arg5,
                relatives = arg7;
        String paymentMethod = arg6;

        float finalFees = (costPerCourse / 10) * numberOfCourses * months;

        //Ypologismos meiwsis (%) logo suggenwn prwtis suggeneias.
        if (relatives > 1) {
            starterCut = starterCut + (cutPerKid * (relatives - 1));
            relativesCut = (finalFees / 100) * starterCut;
        } else if (relatives == 1) {
            relativesCut = (finalFees / 100) * starterCut;
        }
        finalFees = finalFees - relativesCut;

        //Ypologismos meiwsis (%) logo tropou pliromis.
        switch (paymentMethod) {
            case "Εφάπαξ": {
                paymentMethodCut = (finalFees / 100) * 20;
                finalFees = finalFees - paymentMethodCut;
                break;
            }
            case "1 δόση": {
                paymentMethodCut = (finalFees / 100) * 5;
                finalFees = finalFees + paymentMethodCut;
                break;
            }
            case "2 δόσεις": {
                paymentMethodCut = (finalFees / 100) * 10;
                finalFees = finalFees + paymentMethodCut;
                break;
            }
            case "3 δόσεις": {
                paymentMethodCut = (finalFees / 100) * 15;
                finalFees = finalFees + paymentMethodCut;
                break;
            }
            default: {
                JOptionPane.showMessageDialog(null, "Δεν επιλέχθηκε σωστά ο τρόπος πληρωμής.", "Error", JOptionPane.ERROR_MESSAGE);
            }
        }

        return finalFees;
    }

}
